GdkCursor *
-_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display,
- GdkPixbuf *pixbuf,
- gint x,
- gint y)
+_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
+ cairo_surface_t *surface,
+ gdouble x,
+ gdouble y)
{
NSImage *image;
NSCursor *nscursor;
GdkCursor *cursor;
- gboolean has_alpha;
+ GdkPixbuf *pixbuf;
GDK_QUARTZ_ALLOC_POOL;
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
-
+ pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
+ cairo_image_surface_get_width (surface),
+ cairo_image_surface_get_height (surface));
image = gdk_quartz_pixbuf_to_ns_image_libgtk_only (pixbuf);
nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
+ g_object_unref (pixbuf);
+
GDK_QUARTZ_RELEASE_POOL;
return cursor;
display_class->list_devices = gdk_quartz_display_list_devices;
display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name;
- display_class->get_cursor_for_pixbuf = _gdk_quartz_display_get_cursor_for_pixbuf;
+ display_class->get_cursor_for_surface = _gdk_quartz_display_get_cursor_for_surface;
display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;
GdkEvent *event);
/* Display methods - cursor */
-GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
- GdkCursorType type);
-GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
- const gchar *name);
-GdkCursor *_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display,
- GdkPixbuf *pixbuf,
- gint x,
- gint y);
+GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
+ GdkCursorType type);
+GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
+ const gchar *name);
+GdkCursor *_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
+ cairo_surface_t *surface,
+ gdouble x,
+ gdouble y);
gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,